package com.itheima.demo;

import com.itheima.domain.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;

public class Demo {
    public static void main(String[] args) throws Exception{
        InputStream is = Resources.getResourceAsStream("db.xml");
        SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
        SqlSession session = factory.openSession();
        User user = session.selectOne("one.findById");
        System.out.println(user);
        session.close();
        is.close();
    }
}
